package com.gzhryc.jdbc.models;

import java.io.Serializable;

public class JoinEntity implements Comparable<JoinEntity>, Serializable{

	private static final long serialVersionUID = 1L;
	
	protected Class<?> clazz;
	protected String FieldName;
	protected String name;
	protected String[] fromField;
	protected String type;
	protected String toTable;
	protected String[] toField;
	protected String toTableAlias;
	protected Integer priority;
	protected Boolean isDateBranch;

	public Class<?> getClazz() {
		return clazz;
	}
	
	public String getFieldName() {
		return FieldName;
	}

	public void setFieldName(String fieldName) {
		FieldName = fieldName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setClazz(Class<?> clazz) {
		this.clazz = clazz;
	}

	public String[] getFromField() {
		return fromField;
	}

	public void setFromField(String[] fromField) {
		this.fromField = fromField;
	}

	public void setToField(String[] toField) {
		this.toField = toField;
	}

	public String[] getToField() {
		return toField;
	}

	public String getToTable() {
		return toTable;
	}

	public void setToTable(String toTable) {
		this.toTable = toTable;
	}

	public String getToTableAlias() {
		return toTableAlias;
	}

	public void setToTableAlias(String toTableAlias) {
		this.toTableAlias = toTableAlias;
	}

	public Integer getPriority() {
		if(priority == null) {
			priority = 1;
		}
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public Boolean getIsDateBranch() {
		if(isDateBranch == null) {
			isDateBranch = false;
		}
		return isDateBranch;
	}

	public void setIsDateBranch(Boolean isDateBranch) {
		this.isDateBranch = isDateBranch;
	}

	@Override
	public int compareTo(JoinEntity o) {
		return getPriority() - o.getPriority();
	}
}
